home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_300 / 333_02 / p015.awk < prev    next >
Text File  |  1989-04-21  |  253b  |  15 lines

  1.  
  2.  
  3. # interest1 - compute compound interest
  4. #   input:    amount rate years
  5. #   output:    compounded value at the end of each year
  6.  
  7.     {
  8.         i = 1
  9.         while (i <= $3)
  10.         {
  11.         printf("Year %d\t%.2f\n", i, $1 * (1 + $2) ^ i)
  12.         i = i + 1
  13.         }
  14.     }
  15.